/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package editor.impl;

import editor.Attribute;
import editor.DefaultTypes;
import editor.EditorPackage;
import editor.Use;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Attribute</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link editor.impl.AttributeImpl#getAttributeName <em>Attribute Name</em>}</li>
 *   <li>{@link editor.impl.AttributeImpl#getAttributeType <em>Attribute Type</em>}</li>
 *   <li>{@link editor.impl.AttributeImpl#getUse <em>Use</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AttributeImpl extends EObjectImpl implements Attribute {
	/**
   * The default value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getAttributeName()
   * @generated
   * @ordered
   */
	protected static final String ATTRIBUTE_NAME_EDEFAULT = null;

	/**
   * The cached value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getAttributeName()
   * @generated
   * @ordered
   */
	protected String attributeName = ATTRIBUTE_NAME_EDEFAULT;

	/**
   * The default value of the '{@link #getAttributeType() <em>Attribute Type</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getAttributeType()
   * @generated
   * @ordered
   */
	protected static final DefaultTypes ATTRIBUTE_TYPE_EDEFAULT = DefaultTypes.NONE;

	/**
   * The cached value of the '{@link #getAttributeType() <em>Attribute Type</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getAttributeType()
   * @generated
   * @ordered
   */
	protected DefaultTypes attributeType = ATTRIBUTE_TYPE_EDEFAULT;

	/**
   * The default value of the '{@link #getUse() <em>Use</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getUse()
   * @generated
   * @ordered
   */
	protected static final Use USE_EDEFAULT = Use.REQUIRED;

	/**
   * The cached value of the '{@link #getUse() <em>Use</em>}' attribute.
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @see #getUse()
   * @generated
   * @ordered
   */
	protected Use use = USE_EDEFAULT;

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	protected AttributeImpl() {
    super();
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	protected EClass eStaticClass() {
    return EditorPackage.Literals.ATTRIBUTE;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public String getAttributeName() {
    return attributeName;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setAttributeName(String newAttributeName) {
    String oldAttributeName = attributeName;
    attributeName = newAttributeName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.ATTRIBUTE__ATTRIBUTE_NAME, oldAttributeName, attributeName));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public DefaultTypes getAttributeType() {
    return attributeType;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setAttributeType(DefaultTypes newAttributeType) {
    DefaultTypes oldAttributeType = attributeType;
    attributeType = newAttributeType == null ? ATTRIBUTE_TYPE_EDEFAULT : newAttributeType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.ATTRIBUTE__ATTRIBUTE_TYPE, oldAttributeType, attributeType));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public Use getUse() {
    return use;
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	public void setUse(Use newUse) {
    Use oldUse = use;
    use = newUse == null ? USE_EDEFAULT : newUse;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.ATTRIBUTE__USE, oldUse, use));
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID)
    {
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_NAME:
        return getAttributeName();
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_TYPE:
        return getAttributeType();
      case EditorPackage.ATTRIBUTE__USE:
        return getUse();
    }
    return super.eGet(featureID, resolve, coreType);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public void eSet(int featureID, Object newValue) {
    switch (featureID)
    {
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_NAME:
        setAttributeName((String)newValue);
        return;
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_TYPE:
        setAttributeType((DefaultTypes)newValue);
        return;
      case EditorPackage.ATTRIBUTE__USE:
        setUse((Use)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public void eUnset(int featureID) {
    switch (featureID)
    {
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_NAME:
        setAttributeName(ATTRIBUTE_NAME_EDEFAULT);
        return;
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_TYPE:
        setAttributeType(ATTRIBUTE_TYPE_EDEFAULT);
        return;
      case EditorPackage.ATTRIBUTE__USE:
        setUse(USE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public boolean eIsSet(int featureID) {
    switch (featureID)
    {
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_NAME:
        return ATTRIBUTE_NAME_EDEFAULT == null ? attributeName != null : !ATTRIBUTE_NAME_EDEFAULT.equals(attributeName);
      case EditorPackage.ATTRIBUTE__ATTRIBUTE_TYPE:
        return attributeType != ATTRIBUTE_TYPE_EDEFAULT;
      case EditorPackage.ATTRIBUTE__USE:
        return use != USE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

	/**
   * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
   * @generated
   */
	@Override
	public String toString() {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (attributeName: ");
    result.append(attributeName);
    result.append(", attributeType: ");
    result.append(attributeType);
    result.append(", use: ");
    result.append(use);
    result.append(')');
    return result.toString();
  }

} //AttributeImpl
